package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/3/2
 **/
public class GenericDemo {
    public static void main(String[] args) {

        Collection<Point> c = new ArrayList<>();
        c.add(new Point(1,2));
        c.add(new Point(1,3));
        c.add(new Point(1,4));
        c.add(new Point(1,5));
        c.add(new Point(1,6));
        c.add(new Point(1,7));
        Iterator<Point> it = c.iterator();
        while (it.hasNext()) {
            Point a = it.next();
            System.out.println(a);
        }
        for (Point a : c) {
            System.out.println(a);
        }













        /*
        Collection<String> c = new ArrayList<>();
        c.add("a");
        c.add("b");
        c.add("c");
        c.add("d");
        c.add("e");
        Iterator<String> it = c.iterator();
    //  while (it.hasNext()) {
    //      String s = it.next();
    //      System.out.println(s);
    //  }
        for (int i = 0; i < c.size(); i++) {
            String s = it.next();
            System.out.println(s);
        }
     // for (String s : c) {
     //     System.out.println(s);
     // }

         */
    }
}
